#!/bin/perl

# Use a text file with 365 lines.

# Open the file for reading
# Change the filepath to the path and name of the location of your file.
open FILE, "<", "/Users/imranhussain/Documents/365.txt" or die "Can't find file, check the path.\n";

# All we really need is the day of the year ($yyear).
# Keep in mind this starts with 0 so the last day of the year is 364.
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

# Start a counter
my $c = 0;

# Loop through the file
while (<FILE>) {
    if ($c == $yday) {
        print $_;
        last;
    }
    $c++;
}

# Close out the file
close FILE;
